<?php if (!defined('THINK_PATH')) exit(); /*a:5:{s:68:"D:\www\7.com\public/../application/admin\view\xshop\product\add.html";i:1588217084;s:55:"D:\www\7.com\application\admin\view\layout\default.html";i:1583049507;s:52:"D:\www\7.com\application\admin\view\common\meta.html";i:1583049507;s:64:"D:\www\7.com\application\admin\view\xshop\product\add-attrs.html";i:1588217084;s:54:"D:\www\7.com\application\admin\view\common\script.html";i:1583049507;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">

<link rel="shortcut icon" href="/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config); ?>
    };
</script>
    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !\think\Config::get('fastadmin.multiplenav')): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <form id="add-form" class="form-horizontal" onkeydown="if(event.keyCode==13)return false;" role="form" data-toggle="validator" method="POST" action="">
    <ul class="nav nav-tabs" style="margin-bottom: 10px;">
        <li role="presentation" class="active"><a data-toggle="tab" href="#base">基本设置</a></li>
        <li role="presentation"><a data-toggle="tab" href="#attrs">库存/规格</a></li>
    </ul>
    <div class="tab-content">
    <div class="active tab-pane" id="base">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Category_id'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-category_id" data-rule="required" class="form-control selectpicker" name="row[category_id]">
                <?php if(is_array($categoryList) || $categoryList instanceof \think\Collection || $categoryList instanceof \think\Paginator): if( count($categoryList)==0 ) : echo "" ;else: foreach($categoryList as $key=>$vo): ?>
                <option value="<?php echo $vo['id']; ?>"><?php echo $vo['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Title'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Description'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-description" data-rule="required" class="form-control" name="row[description]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Image'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> <?php echo __('Upload'); ?></button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> <?php echo __('Choose'); ?></button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">单位</label>
        <div class="col-xs-12 col-sm-8">
            <select name="row[unit_id]" id="c-unit_id" class="form-control">
                <?php foreach($unitArr as $unit): ?>
                <option value="<?php echo $unit['id']; ?>"><?php echo $unit['name']; ?></option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('On_sale'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <select name="row[on_sale]" id="c-on_sale" class="form-control">
                <option value="1" selected>是</option>
                <option value="0">否</option>
            </select>
        </div>
    </div>
    
    <!-- <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Rating'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-rating" data-rule="required" class="form-control" step="0.01" name="row[rating]" type="number" value="5.00">
        </div>
    </div> -->
    <!-- <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Sold_count'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sold_count" data-rule="required" class="form-control" name="row[sold_count]" type="number" value="0">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Review_count'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-review_count" data-rule="required" class="form-control" name="row[review_count]" type="number" value="0">
        </div>
    </div> -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Service_tags'); ?></label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-service_tags" multiple class="form-control selectpicker" name="row[service_tags][]">
                <?php if(is_array($service_tags) || $service_tags instanceof \think\Collection || $service_tags instanceof \think\Paginator): if( count($service_tags)==0 ) : echo "" ;else: foreach($service_tags as $key=>$vo): ?>
                <option value="<?php echo $vo['title']; ?>"><?php echo $vo['title']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">运费模板</label>
        <div class="col-xs-12 col-sm-8">
            <select name="row[delivery_tpl_id]" id="c-delivery_tpl_id" class="form-control">
                <?php if(is_array($deliveryTpls) || $deliveryTpls instanceof \think\Collection || $deliveryTpls instanceof \think\Paginator): if( count($deliveryTpls)==0 ) : echo "" ;else: foreach($deliveryTpls as $key=>$vo): ?>
                <option value="<?php echo $vo['id']; ?>" <?php if($vo['is_default'] == 1): ?>selected <?php endif; ?>><?php echo $vo['title']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Content'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
        </div>
    </div>
    </div>
    <div class="tab-pane" id="attrs">
        <style>
    .attr-table input {
        padding: 0;
        text-align: center;
    }
    .attr-table thead th {
        text-align: center;
    }
    .attr-table tbody td {
        text-align: center;
        vertical-align: middle!important;
    }
    .attr-table .disabled td, .attr-table .disabled td input {
        background: #F7F7F7;
        color: #b1b1b1;
    }
    .attr-table .sku-img {
        width: 40px; height: 40px;
        cursor: pointer;
        color: #b1b1b1;
        display: inline-block;
        border: 1px solid #ddd;
    }
    .attr-table .sku-img img {
        width: 40px; height: 40px;
    }
</style>
<div class="form-group">
    <label class="control-label col-xs-12 col-sm-2">库存/规格</label>
    <div class="col-xs-12 col-sm-8" id="app" v-cloak>
        <div style="margin-bottom: 5px;">
            <input type="text" class="form-control" style="width: 100px" ref="attr-group-name" @keyup.enter="addRow" placeholder="输入规格名称">
            <a class="btn btn-sm btn-primary" id="btn-add-group" @click="addRow">添加规格</a>
        </div>
        <div>
            <div class="panel panel-default" v-for="(item, i) in attrGroups" :key="i">
                <header class="panel-heading">
                    <span class="pointer color-disabled" @click="removeGroup(i)">X</span>
                    <b>{{item}}</b>
                </header>
                <div class="row" style="margin: 5px 0;">
                    <div class="col-md-6 col-sm-6 col-xs-6">
                        <div class="input-group">
                            <input type="text" class="form-control" @keyup.enter="addChild(i)" :ref="'attr-item-name-' + i">
                            <span class="input-group-addon pointer" @click="addChild(i)">添加</span>
                        </div>
                    </div>
                    <div class="col-md-6 col-sm-6 col-xs-6" style="padding: 5px 0;">
                        <span class="tag pointer" title="移除" v-for="(v, j) in attrItems[i]" :key="j" @click="removeChild(i, j)">{{v}}</span>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row" v-show="productSkus.length">
            <div class="col-md-12">
                <table class="table table-bordered attr-table">
                    <thead>
                        <tr>
                            <th v-for="(item, i) in attrGroups" :key="i">
                                {{item}}
                                <input type="text" name="attrs[group][]" v-show="false" v-model="item" />
                            </th>
                            <th width="80">原价</th>
                            <th width="80">现价</th>
                            <th width="80">库存</th>
                            <th width="80">重量</th>
                            <th width="80">编码</th>
                            <th width="80">图片</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item, i) in productSkus" :key="i">
                            <td v-for="(v, j) in item" :key="j">
                                {{v}}
                            </td>
                            <td width="80">
                                <input type="text" name="attrs[market_price][]" class="input-sm form-control attr-market_price">
                            </td>
                            <td width="80">
                                <input type="text" name="attrs[price][]" class="input-sm form-control attr-price">
                            </td>
                            <td width="80"><input type="text" name="attrs[stock][]" class="input-sm form-control attr-stock"></td>
                            <td width="80"><input type="text" name="attrs[weight][]" class="input-sm form-control attr-weight"></td>
                            <td width="80"><input type="text" name="attrs[sn][]" class="input-sm form-control attr-sn"></td>
                            <td width="80">
                                <input type="hidden" name="attrs[image][]" :id="'c-attr-image-' + i">
                                <div class="sku-img" @click="upimage(i)">
                                    <img v-if="skus[i] && skus[i].image" :src="skus[i] && skus[i].image" :id="'img-attr-image-' + i">
                                    <span v-else>上传图片</span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="center" v-if="attrGroups.length" :colspan="productSkus[0] && productSkus[0].length">批量设置</td>
                            <td align="center">
                                <div class="input-group ">
                                    <input type="text" class="form-control no-padding text-center" id="batch-market_price">
                                    <span class="input-group-addon pointer" onclick="batchSetAttrs('market_price')">设置</span>
                                </div>
                            </td>
                            <td align="center">
                                <div class="input-group ">
                                    <input type="text" class="form-control no-padding text-center" id="batch-price">
                                    <span class="input-group-addon pointer" onclick="batchSetAttrs('price')">设置</span>
                                </div>
                            </td>
                            <td align="center">
                                <div class="input-group">
                                    <input type="text" class="form-control no-padding text-center" id="batch-stock">
                                    <span class="input-group-addon pointer" onclick="batchSetAttrs('stock')">设置</span>
                                </div>
                            </td>
                            <td align="center">
                                <div class="input-group">
                                    <input type="text" class="form-control no-padding text-center" id="batch-weight">
                                    <span class="input-group-addon pointer" onclick="batchSetAttrs('weight')">设置</span>
                                </div>
                            </td>
                            <td align="center">
                                <div class="input-group">
                                    <input type="text" class="form-control" id="batch-sn">
                                    <span class="input-group-addon pointer" onclick="batchSetAttrs('sn')">设置</span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <input type="text" v-show="false" name="attrs[sku]" :value="productSkusStr">
            </div>
        </div>
    </div>
</div>
<style>
[v-cloak] {
    display: none;
}
ul, li {
    list-style: none;
    margin: 0;
    padding: 0;
}
.no-padding {
    padding: 0;
}
.pointer {
    cursor: pointer;
}
.color-disabled {
    color: #999;;
}
.input-group-addon {
    padding: 6px 4px;
}
.tag {
    padding: 2px 10px;
    background-color: #ecf5ff;
    color: #409eff;
    border-radius: 4px;
    border: 1px solid #d9ecff;
    margin: 0 4px;
}
.panel header {
    position: relative;
}
.panel header .header-input {
    position: absolute;
    right: 0;
    top: 50%;
    -webkit-transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
}
.panel-default>.panel-heading {
    color: #333;
    background-color: #f7fafa;
    border-color: #eaeef1;
}
</style>
    </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled"><?php echo __('OK'); ?></button>
            <button type="reset" class="btn btn-default btn-embossed"><?php echo __('Reset'); ?></button>
        </div>
    </div>
</form>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version']); ?>"></script>
    </body>
</html>